#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include <QDebug>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    
    // 加载扁平化风格的样式表
    QFile styleFile(":/qss/flat_style.qss");
    if (styleFile.open(QIODevice::ReadOnly)) {
        QString styleSheet = QLatin1String(styleFile.readAll());
        a.setStyleSheet(styleSheet);
        styleFile.close();
    } else {
        qDebug() << "Failed to open style file: flat_style.qss";
        // 尝试使用绝对路径加载
        QFile styleFileAbsolute(QCoreApplication::applicationDirPath() + ":/qss/flat_style.qss");
        if (styleFileAbsolute.open(QIODevice::ReadOnly)) {
            QString styleSheet = QLatin1String(styleFileAbsolute.readAll());
            a.setStyleSheet(styleSheet);
            styleFileAbsolute.close();
        } else {
            qDebug() << "Failed to open style file with absolute path";
        }
    }
    

    
    MainWindow w;
    w.setAttribute(Qt::WA_StyledBackground, true);
    w.show();

    return a.exec();
}
